﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using rock.UI.picturexml;

namespace rock.UI
{
    public partial class UserControMainPictureInfo : UserControl, UserControlMainSuper
    {
        public UserControMainPictureInfo()
        {
            InitializeComponent();
            this.Dock = DockStyle.Fill;

            //Application.StartupPath
            //String xmlfilepath = @"E:\VS2010\SVN\RentalHousingManager\rockpear\RentalHousingManager2\RentalHousingManager2\UI\picturexml\picture_xml";
            String xmlfilepath = Application.StartupPath + @"\picture\";
           // MessageBox.Show(xmlfilepath);
            List<HtmlFile> htmlfiles = XmlUtil.getHtmlfiles(xmlfilepath+@"htmlfile.xml");
            int i = 0;
            foreach (HtmlFile htmlFile in htmlfiles)
            {
               
                UserControlTestWebView userControlTestWebView = new rock.UI.picturexml.UserControlTestWebView();
               

                userControlTestWebView.Dock = System.Windows.Forms.DockStyle.Fill;
                userControlTestWebView.Location = new System.Drawing.Point(0, 0);
                userControlTestWebView.Name = "userControlTestWebView_" + htmlFile.filename;
                userControlTestWebView.Size = new System.Drawing.Size(976, 566);
                userControlTestWebView.TabIndex = i;
              //  userControlTestWebView.loadHtml(htmlFile.filename);
                userControlTestWebView.filename = xmlfilepath + htmlFile.filename;


                TabPage tabPage = new System.Windows.Forms.TabPage();


                tabPage.SuspendLayout();

                this.tabControl1.Controls.Add(tabPage);
                tabPage.Controls.Add(userControlTestWebView);
                tabPage.Location = new System.Drawing.Point(4, 34);
                tabPage.Name = "tabPage" + i;
                tabPage.Size = new System.Drawing.Size(976, 566);
              //  tabPage.AutoScroll = true;
                tabPage.Dock = System.Windows.Forms.DockStyle.Fill;
                tabPage.TabIndex = htmlFile.orderon;
                tabPage.Text = "" + htmlFile.showname;
                tabPage.UseVisualStyleBackColor = true;

                tabPage.ResumeLayout(false);

                i++; 
            }
           


        }
        public void selectIndex(int index)
        {
            this.tabControl1.SelectedIndex = index;
        }
    }
}
